﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using MainController.Hardware.Machine;
using ParamSetCollection.General.Tools;
using NeoReflow.UI.Example.Controls;
using ParamSetCollection.General.Parameters.Normal;

namespace NeoReflow.UI.Example
{
    /// <summary>
    /// ExampleUI.xaml 的交互逻辑
    /// </summary>
    public partial class ExampleUI : Window
    {
        List<ExTextBox> tbxList = new List<ExTextBox>();
        List<Ex2TextBox> tbx2List = new List<Ex2TextBox>();
        List<PVTextBox> tbx3List = new List<PVTextBox>();

        public ExampleUI()
        {
            InitializeComponent();

            //tbx_lateRenew.pu = JTRSeries.Instance.jtrParam.svParam.CoolZone1LowerTempSV;
            //tbx_fastRenew.pu = JTRSeries.Instance.jtrParam.svParam.CoolZone1UpperTempSV;

            ParamBinding();
        }

        private void ParamBinding()
        {
            CtrlCollectHelper.GetMyCtrlList<Example.Controls.ExTextBox>(gd1.Children, ref tbxList);
            CtrlCollectHelper.GetMyCtrlList<Example.Controls.Ex2TextBox>(gd1.Children, ref tbx2List);
            CtrlCollectHelper.GetMyCtrlList<Example.Controls.PVTextBox>(gd1.Children, ref tbx3List);

            for (int i = 0; i < tbxList.Count; i++)
            {
                JTRSeries.Instance.BindingParams(tbxList[i] as IParamCtrl);
            }


            for (int i = 0; i < tbx2List.Count; i++)
            {
                JTRSeries.Instance.BindingParams(tbx2List[i] as IParamCtrl);
            }

            for (int i = 0; i < tbx3List.Count; i++)
            {
                JTRSeries.Instance.BindingParams(tbx3List[i] as IParamCtrl);
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < tbxList.Count; i++)
            {
                tbxList[i].ConfirmParamSet();
            }
        }
    }
}
